package com.example.purespringboot.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.purespringboot.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.UUID;

/**
 * @Description: 简要功能描述
 * @Author Yabin Bai
 * @Date: 2022/1/6
 * @Version: V1.0
 */
@RestController
@Slf4j
public class InfoController {
    /**
     * hello
     * @return info
     */
    @GetMapping("/helloworld")
    public String hello() {
        log.info("hello");
        return UUID.randomUUID()+"-->>Hello World!\n";
    }



    @GetMapping("/userInfoV1")
    public String userInfo(){
        User user = new User()
                .setEmail("email")
                .setName("name")
                .setLocation("location")
                .setTime(new Date());
        String s = JSONObject.toJSONString(user);
        s+="\n";
        return s;
    }
}
